package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.Kind;
import cn.wolfcode.crm.mapper.KindMapper;
import cn.wolfcode.crm.query.QueryObject;
import cn.wolfcode.crm.service.IKindService;
import cn.wolfcode.crm.util.PageResult;
import cn.wolfcode.crm.util.PageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class KindServiceImpl implements IKindService{
    @Autowired
    private KindMapper mapper;
    public void save(Kind entity) {
        mapper.insert(entity);
    }

    public void update(Kind entity) {
        mapper.updateByPrimaryKey(entity);
    }

    public void delete(Long id) {
        mapper.deleteByPrimaryKey(id);
    }

    public List<Kind> list() {
        return mapper.selectAll();
    }

    public Kind get(Long id) {
        return mapper.selectByPrimaryKey(id);
    }

	public PageResult query(QueryObject qo) {
		return PageUtils.query(qo, mapper);
	}

    public List<Kind> queryKinds() {
        return mapper.selectParent();
    }

    public List<Kind> queryDatas(Long parentId) {
        return mapper.queryDatas(parentId);
    }

    public List<Map<String ,Object>> queryKindTwo() {
        return mapper.queryKindTwo() ;
    }
}
